<?php
//测试控制器类
class IndexController extends Controller{
    //动作方法
	public function index(){

        //显示视图
		$this->display();
	}
	public function addNews(){
		if(IS_POST){
			$db = M('news');
			if($db->add()){
				$this->success('添加成功','index');
			}else{
				$this->error('添加失败','index');
			}
		}else{
			$db= M('category');
			$category =$db->all();
			$category = Data::tree($category,'catname');
			$this->assign('category',$category);
			$this->display();
		}
	}
}
